<div class="panel panel-default panel-intro">
    {:build_heading()}
    <link rel="stylesheet" href="__CDN__/assets/css/colpick.css">
    <div class="panel panel-default panel-intro">
        <div class="panel-heading">
            <ul class="nav nav-tabs" data-field="module">

                {foreach name="positionList" item="vo"}
                <li class="{$key === 'admin' ? 'active' : ''}">
                    <a href="#{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a>
                </li>
                {/foreach}

            </ul>
        </div>

        <div class="panel-body">
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane active in" id="admin">
                    <div class="widget-body no-padding">
                        <form class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('autokeyword/config/edit')}">
                            {:token()}
                            <input type="hidden" name="row[0][view]" value="0">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th width="20%">{:__('后台配置项')}</th>
                                    <th width="40%">{:__('后台配置值')}</th>
                                    <th width="40%">{:__('说明')}</th>
                                </tr>
                                </thead>
                                <tbody>
                                {foreach $list[0] as $item}
                                <tr>
                                    <td>{$item.title}</td>
                                    <td>
                                        <div class="row">
                                            <div class="col-sm-8 col-xs-12">
                                                {switch $item.type}
                                                {case string}
                                                <input type="text" name="row[0][{$item.key}]" value="{$item.value|htmlentities}" class="form-control"/>
                                                {/case}

                                                <!--颜色选择器-->
                                                {case picker}
                                                <input type="text" class="picker-switch" name="row[0][{$item.key}]" value="{$item.value|htmlentities}" data-rule="length[7]" style="font-weight: bold; color: #fff; background-color: {$item.value|htmlentities}; border: 1px solid {$item.value|htmlentities}; " class="form-control"/>
                                                {/case}

                                                <!--开关类型-->
                                                {case switch}
                                                <input id="c-{$item.key}" name="row[0][{$item.key}]" type="hidden" value="{:$item.value?1:0}">
                                                <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.key}" data-yes="1" data-no="0">
                                                    <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
                                                </a>
                                                {/case}

                                                <!--单选类型-->
                                                {case radio}
                                                <div class="radio">
                                                    {foreach name="item.content" item="vo"}
                                                    <label for="row[0][{$item.key}]-{$key}"><input id="row[0][{$item.key}]-{$key}" name="row[0][{$item.key}]" type="radio" value="{$key}" {in name="key" value="$item.value" }checked{/in} /> {$vo}</label>
                                                    {/foreach}
                                                </div>
                                                {/case}

                                                <!--数值-->
                                                {case number}
                                                <input type="number" name="row[0][{$item.key}]" value="{$item.value|htmlentities}" class="form-control" data-rule="integer[+];range[0~]"/>
                                                {/case}

                                                <!--编辑器-->
                                                {case editor}
                                                <textarea name="row[0][{$item.key}]" id="editor-{$item.key}" class="form-control editor" rows="5" >{$item.value|htmlentities}</textarea>
                                                {/case}

                                                {/switch}
                                            </div>
                                        </div>

                                    </td>
                                    <td>
                                        {$item.description}
                                    </td>

                                </tr>
                                {/foreach}

                                </tbody>
                                <tfoot>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
                                        <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                                    </td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                </tfoot>
                            </table>
                        </form>
                    </div>
                </div>
                <div class="tab-pane"  id="index">
                    <div class="widget-body no-padding">
                        <form class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('autokeyword/config/edit')}">
                            {:token()}
                            <input type="hidden" name="row[1][view]" value="1">

                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th width="20%">{:__('前台配置项')}</th>
                                    <th width="40%">{:__('前台配置值')}</th>
                                    <th width="40%">{:__('说明')}</th>
                                </tr>
                                </thead>
                                <tbody>
                                {foreach $list[1] as $item}
                                <tr>
                                    <td>{$item.title}</td>
                                    <td>
                                        <div class="row">
                                            <div class="col-sm-8 col-xs-12">
                                                {switch $item.type}
                                                {case string}
                                                <input type="text" name="row[1][{$item.key}]" value="{$item.value|htmlentities}" class="form-control"/>
                                                {/case}

                                                <!--颜色选择器-->
                                                {case picker}
                                                <input type="text" class="picker-switch" name="row[1][{$item.key}]" value="{$item.value|htmlentities}" data-rule="length[7]" style="font-weight: bold; color: #fff; background-color: {$item.value|htmlentities}; border: 1px solid {$item.value|htmlentities}; " class="form-control"/>
                                                {/case}

                                                <!--开关类型-->
                                                {case switch}
                                                <input id="c-1-{$item.key}" name="row[1][{$item.key}]" type="hidden" value="{:$item.value?1:0}">
                                                <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-1-{$item.key}" data-yes="1" data-no="0">
                                                    <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
                                                </a>
                                                {/case}

                                                <!--单选类型-->
                                                {case radio}
                                                <div class="radio">
                                                    {foreach name="item.content" item="vo"}
                                                    <label for="row[1][{$item.key}]-{$key}"><input id="row[1][{$item.key}]-{$key}" name="row[1][{$item.key}]" type="radio" value="{$key}" {in name="key" value="$item.value" }checked{/in} /> {$vo}</label>
                                                    {/foreach}
                                                </div>
                                                {/case}

                                                <!--数值-->
                                                {case number}
                                                <input type="number" name="row[1][{$item.key}]" value="{$item.value|htmlentities}" class="form-control" data-rule="integer[+];range[0~]"/>
                                                {/case}

                                                <!--编辑器-->
                                                {case editor}
                                                <textarea name="row[1][{$item.key}]" id="editor-{$item.key}" class="form-control editor" rows="5" >{$item.value|htmlentities}</textarea>
                                                {/case}

                                                {/switch}
                                            </div>
                                        </div>

                                    </td>
                                    <td>
                                        {$item.description}
                                    </td>

                                </tr>
                                {/foreach}

                                </tbody>
                                <tfoot>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
                                        <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                                    </td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                </tfoot>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
